const set_question_title = function(question) {
  // 填空题标题
  try {
    if (question.typeId == 4 && question.title) {
      question.inputNum = 0;
      let index = 1;
      let pos = question.title.indexOf("_____");
      console.log(pos);
      while (pos !== -1) {
        question.title = question.title.replace(
          "_____",
          `<span class="five-underline">__<span class="red_color">${index}</span>__</span>`
        );
        index++;
        pos = question.title.indexOf("_____");
      }
      question.inputNum = index - 1;
    }
  } catch (error) {
    throw new Error(error);
  }
};
const is_answered_question = function(question) {
  if (
    question.stuAnswer &&
    question.stuAnswer.length > 0 &&
    question.stuAnswer.some((item) => {
      return item || item == "0";
    })
  ) {
    return true;
  }
  if (question.questionList) {
    let data = question.questionList.some((item) => {
      return (
        item.stuAnswer &&
        item.stuAnswer.length > 0 &&
        item.stuAnswer.some((item) => {
          return item || item == "0";
        })
      );
    });
    return data;
  }
  return false;
};
export { set_question_title,is_answered_question};
